function [K,Weights,name]=ksdenSelfcalib(TF,w,h,numparams,corrs)
Weights=[];
name='ksdensity';
%close all
%clc
width=w;
height=h;
showplots=0;

F=TF;

params(1) = struct('name', 'foc1', 'Krow', 1, 'Kcol', 1);
params(2) = struct('name', 'foc2', 'Krow', 2, 'Kcol', 2);
params(3) = struct('name', 'xc', 'Krow', 1, 'Kcol', 3);
params(4) = struct('name', 'yc', 'Krow', 2, 'Kcol', 3);


s=size(F,2);

K=[width 0 width/2; 0 width height/2; 0 0 1];

numsl=150;
% find foc1
solzarray=[];


usedFs=1:s;

for p=1:size(params,2)
    
solzarray=[];
    for i=1:size(usedFs,2)
        [temparay,xarr]= provideFamilySolution_matrixnorm(F{1,usedFs(1,i)},w,h,2,numsl,K,params(p).name);
        solzarray=[solzarray ; xarr temparay];
        
    end
    
    [f,xi] = ksdensity(solzarray(:,2));
    if(showplots==1)
        figure
        scatter(solzarray(:,1),solzarray(:,2));
        title(params(p).name);
        figure
        plot(xi,f);
        title(params(p).name);
    end
    
    [~,I] = max(f);
    K(params(p).Krow,params(p).Kcol)=xi(I);
end

end

